﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace Licenta1.Expressions
{
    [Serializable]
    class MathNegativeExpression : Expression
    {
        Expression expr1;
 
        public MathNegativeExpression(Context con, Expression e1)
            : base(con)
        {
            expr1 = e1;
        }

        public override object Value
        {
            get
            {
                try
                {
                    double m1 = Convert.ToDouble(expr1.Value);
                    return -m1;
                }
                catch (Exception)
                {
                    return 0;
                }
            }
        }

        public Expression E1
        {
            get { return expr1; }
        }
    }
}